using System;
using System.Collections.Generic;
using UnityEngine;
using Object = UnityEngine.Object;

namespace GameCore
{
    public partial class ObjectPool
    {
        [Obsolete("此方法已过时, 请使用Spawn代替")]
        public T GetObject<T>(string assetPath, Transform parent = null) where T : Object => Spawn<T>(assetPath, parent);

        [Obsolete("此方法已过时, 请使用Spawn代替")]
        public T GetObject<T>(T assetObject, Transform parent = null) where T : Object => Spawn(assetObject, parent);

        [Obsolete("此方法已过时, 请使用UnSpawn代替")]
        public void Recycling(Object instanceObject) => UnSpawn(instanceObject);

        [Obsolete("此方法已过时, 请使用SpawnList代替")]
        public T GetObjectAddList<T>(Enum command, T component, Transform parent = null) where T : Component => SpawnList(command, component, parent);

        [Obsolete("此方法已过时, 请使用UnSpawnList代替")]
        public PoolListCache<T> RecyclingObjectList<T>(Enum command) where T : Component => UnSpawnList<T>(command);

        [Obsolete("此方法已过时, 请使用UnSpawnList代替")]
        public PoolListCache<T> RecyclingObjectList<T>(Enum command, T component, Transform parent = null) where T : Component => UnSpawnList(command, component, parent);

        [Obsolete("此方法已过时, 请使用GetSpawnList代替")]
        public PoolListCache<T> GetObjectList<T>(Enum command) where T : Component => GetSpawnList<T>(command);

        [Obsolete("此方法已过时, 请使用GetSpawnIndex代替")]
        public T GetObjectListIndex<T>(Enum command, int index) where T : Component => GetSpawnIndex<T>(command, index);
    }
}

public static class ObjectPoolExObsolete
{
    [Obsolete("请属于UnSpawns代替!")]
    public static void RecyclingObjects<T>(this List<T> self) where T : Object => ObjectPoolEx.UnSpawns(self);

    [Obsolete("请属于UnSpawns代替!")]
    public static void RecyclingObjects<T>(this T[] self) where T : Object => ObjectPoolEx.UnSpawns(self);

    [Obsolete("请属于UnSpawn代替!")]
    public static void RecyclingObject<T>(this T self) where T : Object => ObjectPoolEx.UnSpawn(self);
}